package com.gopay.checkorder.service.task.thread;

import java.util.concurrent.CountDownLatch;
import java.util.concurrent.LinkedBlockingQueue;

import javax.annotation.Resource;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Service;

import com.gopay.checkorder.service.BcdlOrderService;
import com.gopay.common.domain.bank.BankOrder;
@Service("bcdlOrderProcessTaskThread")
public class BcdlOrderProcessTaskThread implements Runnable {
	 private final static Logger logger = LoggerFactory.getLogger("CHECK_ORDER");
		 @Resource(name = "bcdlOrderService")
	    private BcdlOrderService bcdlOrderService;
		private LinkedBlockingQueue<String> queue;
		private CountDownLatch latch;
	    @Override
	    public void run() {
	    	String bankCode = queue.poll();
	        bcdlOrderService.process(bankCode, "",null);
	    }

		public BcdlOrderService getBcdlOrderService() {
			return bcdlOrderService;
		}

		public void setBcdlOrderService(BcdlOrderService bcdlOrderService) {
			this.bcdlOrderService = bcdlOrderService;
		}


		public LinkedBlockingQueue<String> getQueue() {
			return queue;
		}

		public void setQueue(LinkedBlockingQueue<String> queue) {
			this.queue = queue;
		}

		public CountDownLatch getLatch() {
			return latch;
		}

		public void setLatch(CountDownLatch latch) {
			this.latch = latch;
		}
}
